enums = gnome.mkenums('tracker-miners-enum-types',
  sources: 'tracker-enums.h',
  c_template: 'tracker-miners-enum-types.c.template',
  h_template: 'tracker-miners-enum-types.h.template',
)

tracker_miners_common_enum_header = enums[1]

tracker_miners_common_sources = [
  'tracker-dbus.c',
  'tracker-domain-ontology.c',
  'tracker-debug.c',
  'tracker-error-report.c',
  'tracker-file-utils.c',
  'tracker-fts-config.c',
  'tracker-ioprio.c',
  'tracker-miner.c',
  'tracker-miner-proxy.c',
  'tracker-sched.c',
  'tracker-term-utils.c',
  'tracker-type-utils.c',
  'tracker-utils.c',
  'tracker-locale.c',
  'tracker-seccomp.c',
  enums[0], enums[1],
]

tracker_miners_common_dependencies = [glib, gio, gio_unix, libmath, tracker_sparql]

if battery_detection_library_name == 'upower'
  tracker_miners_common_sources += 'tracker-power-upower.c'
  tracker_miners_common_dependencies += upower
elif battery_detection_library_name == 'hal'
  tracker_miners_common_sources += 'tracker-power-hal.c'
  tracker_miners_common_dependencies += hal
endif

tracker_miners_common_private_dependencies = [charset_library, blkid]
if libseccomp.found()
  tracker_miners_common_private_dependencies += [libseccomp]
endif

if build_machine.system() == 'openbsd'
  libkvm = meson.get_compiler('c').find_library('kvm')
  tracker_miners_common_dependencies += libkvm
endif

libtracker_miners_common = static_library('tracker-miners-common',
  tracker_miners_common_sources,
  dependencies: tracker_miners_common_dependencies + tracker_miners_common_private_dependencies,
  c_args: tracker_c_args + [
      '-DTRACKERSHAREDIR="@0@"'.format(tracker_versioned_name),
      '-DONTOLOGIESDIR="@0@"'.format(tracker_ontologies_dir),
  ],
  include_directories: [configinc, srcinc],
)

commoninc = include_directories('.')

tracker_miners_common_dep = declare_dependency(
  sources: [tracker_miners_common_enum_header],
  link_with: libtracker_miners_common,
  dependencies: tracker_miners_common_dependencies,
  include_directories: [configinc, srcinc, commoninc],
)
